<!doctype html>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/_mozilla/bluetooth/bluetooth-helpers.js"></script>
<script>
'use strict';
promise_test(t => {
    let expected = 'SecurityError';
    window.testRunner.setBluetoothMockDataSet(adapter_type.blocklist);
    return window.navigator.bluetooth.requestDevice({
        filters: [{services: [blocklist_test_service_uuid]}],
        optionalServices: [human_interface_device.name]
    })
    .then(device => device.gatt.connect())
    .then(gattServer => Promise.all([
          promise_rejects_dom(t, expected, gattServer.getPrimaryService(human_interface_device.name)),
          promise_rejects_dom(t, expected, gattServer.getPrimaryServices(human_interface_device.name))]));
}, 'Blocklisted UUID in optionalServices is removed and access not granted.');
</script>
